

#pragma once

#include "cocos2d.h"
USING_NS_CC;

#include "type.h"
#include "equipment.h"

using namespace std;

class EquipmentDetailLayer : public CCLayer {
public:
	EquipmentDetailLayer();
	virtual ~EquipmentDetailLayer();

    CREATE_FUNC(EquipmentDetailLayer);

	void setAttribute(const string& name, const EquipmentAttribute& attr, bool allowEdit = false);

private:
	virtual bool init();

	void onClose(CCObject* sender);
	void onEdit(CCObject* sender);

private:
	CCLabelTTF* _labelTitle;
	CCLabelTTF* _labelRarity;
	CCLabelTTF* _labelPoints;
	CCLabelTTF* _labelDesc;
	CCLabelTTF* _labelDefense;
	CCLabelTTF* _labelRange;
	CCLabelTTF* _labelCastingTimeTitle;
	CCLabelTTF* _labelReloadTimeTitle;
	CCLabelTTF* _labelTime;

	CCSprite* _attackValueLabels[(int)DamageType::count];
	CCSprite* _resistValueLabels[(int)DamageType::count];

	CCLabelTTF* _attackValues[(int)DamageType::count];
	CCLabelTTF* _resistValues[(int)DamageType::count];

	CCMenuItemSprite* _btnEdit;

	static int attack_column1_x;
	static int attack_column2_x;
	static int resist_column1_x;
	static int resist_column2_x;
	static int first_row_y;
	static int row_height;
	static int label_value_space;

	char buf[200];
};
